package cn.good.yan.controller;

import cn.good.yan.pojo.Oreder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


/**
 * 客户端1  接口
 * <p>
 * 请求接口：http://localhost:9003/order/list
 *
 * @author shengren.yan
 * @create 2024-01-09
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {


    // 访问：客户端1 ， 接口
    @GetMapping(value = "/list")
    public List<Oreder> list() {
        List<Oreder> list = new ArrayList<>();
        list.add(new Oreder(1, "订单1", "red"));
        list.add(new Oreder(2, "订单2", "green"));
        list.add(new Oreder(3, "订单3", "let"));
        return list;
    }

    @GetMapping(value = "/one")
    public Oreder one() {
        List<Oreder> list = new ArrayList<>();
        list.add(new Oreder(1, "订单1", "red"));
        list.add(new Oreder(2, "订单2", "green"));
        list.add(new Oreder(3, "订单3", "let"));
        return list.get(0);
    }

}
